package com.platform.cdcs.fragment.custom;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.platform.cdcs.R;
import com.platform.cdcs.fragment.detail.TicketErrFragment;
import com.platform.cdcs.model.BaseObjResponse;
import com.platform.cdcs.model.MockObj;
import com.platform.cdcs.model.PriceItem;
import com.platform.cdcs.model.ReportInfo;
import com.platform.cdcs.tool.Constant;
import com.platform.cdcs.tool.FragmentUtil;
import com.platform.cdcs.tool.ViewTool;
import com.trueway.app.uilib.fragment.BaseFragment;
import com.trueway.app.uilib.tool.Utils;
import com.zhy.http.okhttp.callback.StringCallback;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

import okhttp3.Call;

/**
 * Created by holytang on 2017/11/20.
 */
public class PriceDetailFragment extends BaseFragment {

    private View rootView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void initView(View view) {
        setTitle("价格详情");
        getToolBar().setNavigationIcon(R.mipmap.icon_back);
        getToolBar().setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getActivity().finish();
            }
        });
        rootView = view;
        rootView.findViewById(R.id.text).setVisibility(View.GONE);
        setData((PriceItem) getArguments().getSerializable("model"));
    }

    @Override
    public int layoutId() {
        return R.layout.five_layout;
    }

    private void setData(PriceItem info) {
        rootView.findViewById(R.id.button2).setVisibility(View.GONE);
        rootView.findViewById(R.id.button3).setVisibility(View.GONE);
        rootView.findViewById(R.id.button4).setVisibility(View.GONE);
        rootView.findViewById(R.id.button5).setVisibility(View.GONE);
        LayoutInflater inflater = LayoutInflater.from(getContext());
        LinearLayout root1 = (LinearLayout) rootView.findViewById(R.id.button1);
        TextView[] views = ViewTool.setFourItemOnly(inflater, root1, new String[]{"", "¥"+info.getPrice()});
        views[0].setVisibility(View.GONE);
        views[1].getPaint().setFakeBoldText(true);
        ViewTool.setFourItem(inflater, root1, new String[]{"产品类型", "单位"}, new String[]{info.getItemCode(), info.getUom()});
        ViewTool.setFourItem(inflater, root1, new String[]{"客户代码", "发票号"}, new String[]{info.getCusCode(), info.getInno()});
        ViewTool.setFourItemOnly(inflater, root1, new String[]{"客户名称", info.getCusName()});
        ViewTool.setFourItemOnly(inflater, root1, new String[]{"创建时间", info.getCreateTime()});
    }

}
